﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Boiling.BizFacade;
using Boiling.Common;

namespace Boiling.Web
{
    public partial class RegisterConfirm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string m_UserName;
            string m_PassWord;
            string m_rePassWord;
            string m_Email;
            string m_Age;
            string m_Sex;
            string m_Shcool;
            string m_schoolID;
            int checkState;

            UserSystem m_user = new UserSystem();
            m_UserName = Request.Form["UserName"];
            m_PassWord = Request.Form["PassWord"];
            m_rePassWord = Request.Form["rePassWord"];
            m_Email = Request.Form["Email"];
            m_Age = Request.Form["Age"];
            m_Sex = Request.Form["Sex"];
            m_schoolID = Request.Form["schoolID"];
            m_Shcool = Request.Form["School"];
            Response.Write("网站目前处于测试阶段：</br></br>");

            Response.Write("username: " + m_UserName + "</br>");
            Response.Write("password: " + m_PassWord + "</br>");
            Response.Write("repassword: " + m_rePassWord + "</br>" + m_Email + "</br>" + m_Sex+ "</br>" + m_Shcool + "</br>");


            // CheckState
            ///     验证码不正确返回2
            ///     两次密码不相同返回3
            ///     创建用户成功返回1
            ///     创建失败返回0
            ///     若注册邮箱已经存在，返回4
            b_Userdata aaa;
            b_UserInfodata bbb;
            checkState = 1;
            checkState = m_user.CreatUser(m_UserName, m_Email, m_PassWord, m_rePassWord,m_schoolID,m_Shcool, m_Age, m_Sex,out aaa, out bbb);
            if (checkState == 0) Response.Write("创建用户失败！ </br>");
            if (checkState == 1) Response.Write("创建用户成功， 欢迎加入Boiling社区！</br>");
            if (checkState == 2) Response.Write("验证码不正确 </br>");
            if (checkState == 3) Response.Write("两次输入密码不一致 </br>");
            if (checkState == 4) Response.Write("注册邮箱已经存在 </br>");

            Response.Write("<a href=" + "default.aspx title=" + "Home" + ">回到首页</a>");
            Response.Redirect("default.aspx");
                        
        }
    }
}
